Optimal. Leaf size=46 \[ \frac{\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac{a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac{2 a b \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.168135, antiderivative size = 70, normalized size of antiderivative = 1.52, number of steps used = 8, number of rules used = 8, integrand size = 27, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.296, Rules used = {2911, 3767, 8, 3201, 446, 78, 63, 206} \[ \frac{\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac{a^2 \sqrt{\cos ^2(c+d x)} \sec (c+d x) \tanh ^{-1}\left (\sqrt{\cos ^2(c+d x)}\right )}{d}+\frac{2 a b \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2911
Rule 3767
Rule 8
Rule 3201
Rule 446
Rule 78
Rule 63
Rule 206
Rubi steps
\begin{align*} \int \csc (c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \sec ^2(c+d x) \, dx+\int \csc (c+d x) \sec ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=-\frac{(2 a b) \operatorname{Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}+\frac{\left (\sqrt{\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname{Subst}\left (\int \frac{a^2+b^2 x^2}{x \left (1-x^2\right )^{3/2}} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac{2 a b \tan (c+d x)}{d}+\frac{\left (\sqrt{\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname{Subst}\left (\int \frac{a^2+b^2 x}{(1-x)^{3/2} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac{\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac{2 a b \tan (c+d x)}{d}+\frac{\left (a^2 \sqrt{\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{1-x} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac{\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac{2 a b \tan (c+d x)}{d}-\frac{\left (a^2 \sqrt{\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname{Subst}\left (\int \frac{1}{1-x^2} \, dx,x,\sqrt{\cos ^2(c+d x)}\right )}{d}\\ &=\frac{\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac{a^2 \tanh ^{-1}\left (\sqrt{\cos ^2(c+d x)}\right ) \sqrt{\cos ^2(c+d x)} \sec (c+d x)}{d}+\frac{2 a b \tan (c+d x)}{d}\\ \end{align*}
Mathematica [A] time = 0.197143, size = 58, normalized size = 1.26 \[ \frac{\left (a^2+b^2\right ) \sec (c+d x)+a \left (a \left (\log \left (\sin \left (\frac{1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac{1}{2} (c+d x)\right )\right )\right )+2 b \tan (c+d x)\right )}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.075, size = 68, normalized size = 1.5 \begin{align*}{\frac{{a}^{2}}{d\cos \left ( dx+c \right ) }}+{\frac{{a}^{2}\ln \left ( \csc \left ( dx+c \right ) -\cot \left ( dx+c \right ) \right ) }{d}}+2\,{\frac{ab\tan \left ( dx+c \right ) }{d}}+{\frac{{b}^{2}}{d\cos \left ( dx+c \right ) }} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.01197, size = 86, normalized size = 1.87 \begin{align*} \frac{a^{2}{\left (\frac{2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + 4 \, a b \tan \left (d x + c\right ) + \frac{2 \, b^{2}}{\cos \left (d x + c\right )}}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.95302, size = 209, normalized size = 4.54 \begin{align*} -\frac{a^{2} \cos \left (d x + c\right ) \log \left (\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) - a^{2} \cos \left (d x + c\right ) \log \left (-\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) - 4 \, a b \sin \left (d x + c\right ) - 2 \, a^{2} - 2 \, b^{2}}{2 \, d \cos \left (d x + c\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.21544, size = 77, normalized size = 1.67 \begin{align*} \frac{a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) - \frac{2 \,{\left (2 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - 1}}{d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]